package com.itshizhan.designpattern.factory_method.idcard;

import com.itshizhan.designpattern.factory_method.framework.Factory;
import com.itshizhan.designpattern.factory_method.framework.Product;

import java.util.ArrayList;
import java.util.List;

/**
 * ConcreteCreator 具体的创建者
 * 负责生成具体的产品
 */
public class IDCardFactory extends Factory {
    private List owners = new ArrayList<>();

    @Override
    protected Product createProduct(String owner) {
        return new IDCard(owner);
    }

    @Override
    protected void registerProduct(Product product) {
        owners.add(((IDCard)product).getOwner());
    }

    public List getOwners(){
        return owners;
    }
}
